﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace CasterDPSMeter
{
    public partial class CritChanceDialog : Form
    {
        public CritChanceDialog()
        {
            InitializeComponent();
        }

        public Player Player { get; set; }

        private void ok_Click(object sender, EventArgs e)
        {
            Player.CritChance.Holy = Double.Parse(holy.Text.TrimEnd('%'));
            Player.CritChance.Fire = Double.Parse(fire.Text.TrimEnd('%'));
            Player.CritChance.Nature = Double.Parse(nature.Text.TrimEnd('%'));
            Player.CritChance.Frost = Double.Parse(frost.Text.TrimEnd('%'));
            Player.CritChance.Shadow = Double.Parse(shadow.Text.TrimEnd('%'));
            Player.CritChance.Arcane = Double.Parse(arcane.Text.TrimEnd('%'));
        }

        private void CritChanceDialog_Load(object sender, EventArgs e)
        {
            holy.Text = Player.CritChance.Holy.ToString();
            fire.Text = Player.CritChance.Fire.ToString();
            nature.Text = Player.CritChance.Nature.ToString();
            frost.Text = Player.CritChance.Frost.ToString();
            shadow.Text = Player.CritChance.Shadow.ToString();
            arcane.Text = Player.CritChance.Arcane.ToString();
        }

        private void SelectAllText(object sender, EventArgs e)
        {
            ((MaskedTextBox)sender).SelectAll();
        }
    }
}
